package com.tjetc.entity;


import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author gaoyongxiang
 * @version v1.0
 * @date 2025/9/4
 */
public class User {

    private String username;

    // 这个是校验注解
    @Range(min = 1, max = 10)
    private Integer age;

    // 是转换注解 向前端传递数据的格式 后面我们使用json会对数据进行格式化 也会用一个新的框架进行校验
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date date;

    // 后端向前端传递的数据格式
    @NumberFormat(pattern = "###,###.##")
    private BigDecimal price;

    private A a;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public A getA() {
        return a;
    }

    public void setA(A a) {
        this.a = a;
    }


    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }


    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", age=" + age +
                ", date=" + date +
                ", price=" + price +
                ", a=" + a +
                '}';
    }
}